<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Document</title>
    <script src="../../../vue.js"></script>
  </head>

  <body>
    <div id="app">
      <App />
    </div>
    <script>
      Vue.config.productionTip = false;

      //假设Header组件是一个公共组件,我们可以直接全局注册Header组件,那么就可以在任意组件中直接使用
      const Header = {
        name: "Header",
        template: `
          <h2>Header</h2>
        `,
      };

      /* 
        使用Vue.component('组件名称',组件)对某个组件进行全局注册
      */
      Vue.component("Header", Header);

      const App = {
        name: "App",
        template: `
        <div>
          <h1>App组件</h1>  
          <Header></Header>
        </div>
      `,
      };
      const vm = new Vue({
        el: "#app",
        components: {
          App,
        },
        data() {
          return {};
        },
      });
    </script>
  </body>
</html>
